package com.example.rabbitdemo.controller;

import com.example.rabbitdemo.utils.RedisUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequestMapping("/redis")
public class RedisController {
    @Autowired
    private RedisUtil redisUtil;

    @GetMapping("/set")
    public String test1(String key,String value){
        log.info(key+"==="+value);
        redisUtil.set(key,value,30);
        return "ok";
    }
    @GetMapping("/get")
    public Object test2(String key){
        System.out.println(redisUtil.get(key));
        return redisUtil.get(key);
    }


}
